<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Hyves.net - Always in touch with your friends</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="<%=basePath%>/style/main.css" type="text/css"
			rel="stylesheet" />
		<link href="<%=basePath%>/style/style20.css" type="text/css"
			rel="stylesheet" />
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>/style/admin_style.css" />
		<script language="javascript"
			src="<%=basePath%>/script/jquery1.3.2.js" type="text/javascript"></script>
		<script language="javascript"
			src="<%=basePath%>/script/jquery.form.js" type="text/javascript"></script>
		<script language="javascript" type="text/javascript">
				function ishowSub(id){
					$("#sid").val(id);
					$.ajax({
						type : "POST",
						dataType : "html",
						url : "<%=basePath%>/info/showSubSort",
						data : {
							id : id
						},
						success : function(data) {
							$("#subSort-show-div").html(data);
						}
					});
				}
				function iedit(id,name){
					$("#sort-name").val(unescape(name));
					$("#infoSortSubmitBtn").val("修改");
					$("#sid").val(id);
					$("#infoSortForm").attr("action","<%=basePath%>/info/updateSort");
				}
				function idelete(id){
					$.ajax({
						type : "POST",
						dataType : "html",
						url : "<%=basePath%>/info/deleteSort",
						data : {
							id : id
						},
						success : function() {
							alert('删除成功');
							location.reload();
						}
					});
				}
				function sedit(id,name){
					$("#subSort-name").val(unescape(name));
					$("#infoSortSubSubmitBtn").val("修改");
					$("#sid").val(id);
					$("#infoSubSortForm").attr("action","<%=basePath%>/info/updateSubSort");
				}
				function sdelete(id){
					$.ajax({
						type : "POST",
						dataType : "html",
						url : "<%=basePath%>/info/deleteSubSort",
						data : {
							id : id
						},
						success : function() {
							alert('删除成功');
							location.reload();
						}
					});
				}
				$(function(){
					/* 新建栏目的ajax表单提交 */
					$('#infoSortSubmitBtn:a').click(function() {
						$("#infoSortForm").ajaxSubmit({success : function(data) {
								alert($("#infoSortSubmitBtn").val()+"成功!");
								location.reload();
							}});
							return false;
						});
					/* 新建二级栏目的ajax表单提交 */
					$("#infoSortSubSubmitBtn").click(function() {
						$("#infoSubSortForm").ajaxSubmit({success : function(data) {
								alert($("#infoSortSubSubmitBtn").val()+"成功!");
								location.reload();
							}});
							return false;
						});
				});
		</script>
	</head>
	<body>
		<div class="generalbox overview_block">
			<div
				class="generalbox_header overview_veryunevenlargecolumn_width generalbox_header_heavy">
				<div class="box_leftheader generalbox_leftheader">
					<img class="inlineicon transparentpng" height="16" alt=""
						src="<%=basePath%>/images/document.png" width="16" />
					资讯栏目设置
				</div>
				<div class="clearer"></div>
			</div>
			<div
				class="generalbox_body generalbox_background_white overview_veryunevenlargecolumn_width">
				<div class="singlecontent_block">
					<table class="pn-ftable" width="100%" cellspacing="1"
						cellpadding="0" border="0" align="center">
						<thead class="pn-lthead" align="center">
							<tr>
								<th>
									ID
								</th>
								<th>
									资讯栏目
								</th>
								<th>
									文档数量
								</th>
								<th>
									创建日期
								</th>
								<th>
									操作
								</th>
							</tr>
						</thead>
						<tbody class="pn-ltbody">
							<s:iterator value="infoSortList" id="isl">
								<tr id="result">
									<td>
										${isl.id }
									</td>
									<td id="nsl-name">
										${isl.name }
									</td>
									<td>
										${isl.infoSubSort.size() }
									</td>
									<td>
										${isl.created }
									</td>
									<td class="pn-lopt">
										<a href="javascript:ishowSub(${isl.id });"
											class="pn-loperator">查看下级目录</a>┆
										<a href="javascript:iedit(${isl.id },escape('${isl.name }'));"
											class="pn-loperator">修改</a>┆
										<a href="javascript:idelete(${isl.id });" class="pn-loperator">删除</a>
									</td>
								</tr>
							</s:iterator>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<br />
		<div class="generalbox overview_block">
			<div
				class="generalbox_header overview_veryunevenlargecolumn_width generalbox_header_heavy">
				<div class="box_leftheader generalbox_leftheader">
					<img class="inlineicon transparentpng" height="16" alt=""
						src="<%=basePath%>/images/document.png" width="16" />
					资讯栏目操作
				</div>
				<div class="clearer"></div>
			</div>
			<div
				class="generalbox_body generalbox_background_white overview_veryunevenlargecolumn_width">
				<div class="singlecontent_block">
					<form action="<%=basePath%>/info/addSort" method="post"
						id="infoSortForm">
						<input type="hidden" id="sort-id" name="id" />
						<table class="pn-ltable" width="50%" cellspacing="1"
							cellpadding="0" border="0" align="center">
							<tr>
								<td>
									栏目名称：
								</td>
								<td>
									<input id="sort-name" type="text" name="infoSort.name" />
								</td>
								<td valign="top" class="BodyTextSmall" colspan="2" align="right">
									<input type="button" id="infoSortSubmitBtn" value="添加" />
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
		<br />
		<br />
		<br />
		<div id="subSort-show-div">
			<div class="generalbox overview_block">
				<div
					class="generalbox_header overview_veryunevenlargecolumn_width generalbox_header_heavy">
					<div class="box_leftheader generalbox_leftheader">
						<img class="inlineicon transparentpng" height="16" alt=""
							src="<%=basePath%>/images/document.png" width="16" />
						资讯二级栏目设置
					</div>
					<div class="clearer"></div>
				</div>
				<div
					class="generalbox_body generalbox_background_white overview_veryunevenlargecolumn_width">
					<div class="singlecontent_block">
						<table class="pn-ftable" width="100%" cellspacing="1"
							cellpadding="0" border="0" align="center">
							<thead class="pn-lthead" align="center">
								<tr>
									<th>
										ID
									</th>
									<th>
										二级资讯栏目
									</th>
									<th>
										文档数量
									</th>
									<th>
										创建日期
									</th>
									<th>
										操作
									</th>
								</tr>
							</thead>
							<tbody class="pn-ltbody">
								<s:iterator value="infoSubSortList" id="issl">
									<tr id="result">
										<td>
											${issl.id }
										</td>
										<td id="nsl-name">
											${issl.name }
										</td>
										<td>
											${issl.infoItem.size() }
										</td>
										<td>
											${issl.created }
										</td>
										<td class="pn-lopt">
											<a
												href="javascript:sedit(${issl.id },escape('${issl.name }'));"
												class="pn-loperator">修改</a>┆
											<a href="javascript:sdelete(${issl.id });"
												class="pn-loperator">删除</a>
										</td>
									</tr>
								</s:iterator>
							</tbody>
						</table>
					</div>
				</div>
			</div>
			<br />
			<div class="generalbox overview_block">
				<div
					class="generalbox_header overview_veryunevenlargecolumn_width generalbox_header_heavy">
					<div class="box_leftheader generalbox_leftheader">
						<img class="inlineicon transparentpng" height="16" alt=""
							src="<%=basePath%>/images/document.png" width="16" />
						资讯二级栏目操作
					</div>
					<div class="clearer"></div>
				</div>
				<div
					class="generalbox_body generalbox_background_white overview_veryunevenlargecolumn_width">
					<div class="singlecontent_block">
						<form action="<%=basePath%>/info/addSubSort" method="post"
							id="infoSubSortForm">
							<input type="hidden" id="sid" name="id" />
							<table class="pn-ltable" width="50%" cellspacing="1"
								cellpadding="0" border="0" align="center">
								<tr>
									<td>
										栏目名称：
									</td>
									<td>
										<input id="subSort-name" type="text" name="infoSubSort.name" />
									</td>
									<td valign="top" class="BodyTextSmall" colspan="2"
										align="right">
										<input type="button" id="infoSortSubSubmitBtn" value="添加" />
									</td>
								</tr>
							</table>
						</form>
					</div>
				</div>
			</div>
		</div>
		<br />
	</body>
</html>